package com.ruowei.modules.foodOrder.domain.enumeration;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.ruowei.config.enumConfig.BaseEnum;

/**
 * The FlowType enumeration.
 */
public enum FlowType implements BaseEnum {
    ORDER("1", "支付"),
    REFUND("2", "退款"),
    CANCEL("3", "取消");

    private final String code;
    private final String message;

    FlowType(String code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    @JsonValue
    public String getMessage() {
        return message;
    }

    @JsonCreator
    public static FlowType deserializer(String value) {
        for (FlowType item : values()) {
            if (value.equals(item.getCode())
                || value.equals(item.getMessage())) {
                return item;
            }
        }
        return null;
    }
}
